/*
 * QE3e Qt Quick 3D Engine.
 * Copyright (C) 2010 Joris Vaillant and Mathieu Pujol 
 * <joris.vaillant@gmail.com>  <mathieu.pujol87@gmail.com>
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */


#ifndef QE3E_TRANSFORM_H
#define QE3E_TRANSFORM_H

// global
#include "qe3e_global.h"

//Qt
#include <QMatrix4x4>

namespace qe3e
{
  class QE3E_EXPORT Transform
  {
  public:
    Transform();

    void scale(qreal sX, qreal sY, qreal sZ);
    void scale(qreal sFactor);
    void scale(const QVector3D & s);

    Transform scaled(qreal sX, qreal sY, qreal sZ) const;
    Transform scaled(qreal sFactor) const;
    Transform scaled(const QVector3D& s) const;

    void setTranslation(qreal tX, qreal tY, qreal tZ);
    void setTranslation(const QVector3D & t);

    void translate(qreal tX, qreal tY, qreal tZ);
    void translate(const QVector3D & t);

    Transform translated(qreal tX, qreal tY, qreal tZ) const;
    Transform translated(const QVector3D& t) const;

    void rotate(qreal angle, qreal axisX, qreal axisY, qreal axisZ);
    void rotate(qreal angle, const QVector3D & axis);
    void rotate(const QQuaternion & quat);

    Transform rotated(qreal angle, qreal axisX, qreal axisY, qreal axisZ) const;
    Transform rotated(qreal angle, const QVector3D& axis) const;
    Transform rotated(const QQuaternion& quat) const;

    void setIdentity();

    const QMatrix4x4 & getMatrix() const;
    void getFloatColumnMajorMatrix(float * buffer) const;
    void getFloatRowMajorMatrix(float * buffer) const;

    Transform operator*(const Transform & transform) const;
  private:
    QMatrix4x4 mMatrix;
  };
}

#endif // QE3E_TRANSFORM_H
